import os,datetime

def scan_path(filepath):
    for dirName, subdirList, fileList in os.walk(filepath):
        print('Folder: %s' % dirName)
        for fname in fileList:
            print('\t%s' % fname)

def check_img(filepath, suffix, student_num, date):
    for dirName, subdirList, fileList in os.walk(filepath):
        for fname in fileList:
            if suffix in fname:
                if student_num+"\\"+date in dirName:
                    return True
    return False
                        
def get_img_path(filepath, suffix, student_num, date):
    img_path = ""
    dirs = []
    for dirName, subdirList, fileList in os.walk(filepath):
        for fname in fileList:
            if suffix in fname:
                if student_num+"\\"+date in dirName:
                    if dirName not in dirs:
                        img_path = dirName+"\\"+fname
                        dirs.append(dirName)
    return img_path

def main():
    scan_path(os.getcwd())
    os.system('pause')
    
if __name__ == '__main__':
    main()